package main

import (
	"dc-news-admin-api/common/global/setting"
	"dc-news-admin-api/common/log"
	"dc-news-admin-api/dao"
	"dc-news-admin-api/routers"
	"fmt"
	"go.uber.org/zap"
)

func main() {
	log.InitLogs(zap.DebugLevel)
	if err := setting.Init("./conf/config.ini"); err != nil {
		zap.L().Error(err.Error())
		return
	}
	if err := dao.DbConn(setting.Conf.MySQLConfig); err != nil {
		zap.L().Error(err.Error())
		return
	}
	r := routers.SetupRouter()
	if err := r.Run(fmt.Sprintf(":%d", setting.Conf.Port)); err != nil {
		zap.L().Error(err.Error())
		return
	}
}
